<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的发布</title>
    <link rel="stylesheet" href="/static/css/index.css">
    <style>
        .my-items-container { max-width: 900px; margin: 40px auto; background: #fff; padding: 30px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
        .my-items-title { text-align: center; margin-bottom: 24px; }
        .item-list { margin-top: 20px; }
        .item-card { display: flex; align-items: center; border-bottom: 1px solid #eee; padding: 16px 0; }
        .item-img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; margin-right: 24px; }
        .item-info { flex: 1; }
        .item-title { font-size: 18px; font-weight: bold; }
        .item-detail { color: #888; margin: 6px 0; }
        .item-actions { display: flex; gap: 12px; }
        .edit-btn { background: #2196f3; color: #fff; border: none; border-radius: 4px; padding: 6px 18px; cursor: pointer; }
        .edit-btn:hover { background: #1565c0; }
        .delete-btn { background: #f44336; color: #fff; border: none; border-radius: 4px; padding: 6px 18px; cursor: pointer; }
        .delete-btn:hover { background: #b71c1c; }
    </style>
</head>
<body>
    <div class="my-items-container">
        <h2 class="my-items-title">我的发布</h2>
        <div class="item-list">
            {{range .items}}
            <div class="item-card">
                <img class="item-img" src="{{if .Image}}{{.Image}}{{else}}/static/img/default.jpg{{end}}" alt="{{.Title}}">
                <div class="item-info">
                    <div class="item-title">{{.Title}}</div>
                    <div class="item-detail">价格：￥{{.Price}} | {{.Detail}}</div>
                </div>
                <div class="item-actions">
                    <form method="get" action="/edit/item/{{.ID}}" style="display:inline;">
                        <button type="submit" class="edit-btn">编辑</button>
                    </form>
                    <form method="post" action="/delete/item/{{.ID}}" style="display:inline;">
                        <button type="submit" class="delete-btn" onclick="return confirm('确定要删除该商品吗？')">删除</button>
                    </form>
                </div>
            </div>
            {{else}}
            <div style="text-align:center;color:#888;">暂无发布的商品</div>
            {{end}}
        </div>
    </div>
</body>
</html>
